---
title: "2weekstudy"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(psych)
library(dplyr)
dat <- read.csv("part1_data_raw.csv")
summary(dat$age)
table(dat$gender)
table(dat$ethnic)
```

### Creating Subscales
```{r}
#FNE
#reverse code
dat$FNE_2 <- 6-dat$FNE_2 
dat$FNE_4 <- 6-dat$FNE_2 
dat$FNE_7 <- 6-dat$FNE_2 
dat$FNE_10 <- 6-dat$FNE_2 

#scale
dat$FNE <- dat %>% select(FNE_1:FNE_12) %>% rowMeans(na.rm=T)
describe(dat$FNE)
FNE <- dat %>% select(FNE_1:FNE_12)
alpha(FNE)

#social support for secret
dat$socsup <- dat %>% select(soc_support_1:soc_support_6) %>% rowMeans(na.rm=T)
describe(dat$socsup)
socsup <- dat %>% select(soc_support_1:soc_support_6)
alpha(socsup)

#authenticity
dat$authenscale <- dat %>% select(authen_scale_1:authen_scale_4) %>% rowMeans(na.rm=T)
describe(dat$authenscale)
authenscale <- dat %>% select(authen_scale_1:authen_scale_4)
alpha(authenscale)

#relationship satisfaction
dat$relsatis <- dat %>% select(rel_satisf_1:rel_satisf_5) %>% rowMeans(na.rm=T)
describe(dat$relsatis)
relsatis <- dat %>% select(rel_satisf_1:rel_satisf_5)
alpha(relsatis)
describe(dat$intimacy_1)

#anxiety
dat$anxious <- dat %>% select(anxdep_1:anxdep_6) %>% rowMeans(na.rm=T)
describe(dat$anxious)
anxious <- dat %>% select(anxdep_1:anxdep_6)
alpha(anxious)

#depressed
dat$depress <- dat %>% select(anxdep_7:anxdep_12) %>% rowMeans(na.rm=T)
describe(dat$depress)
depress <- dat %>% select(anxdep_7:anxdep_12)
alpha(depress)

#flourish
dat$flourish <- dat %>% select(flourish_1:flourish_8) %>% rowMeans(na.rm=T)
describe(dat$flourish)
flourish <- dat %>% select(flourish_1:flourish_8)
alpha(flourish)

#burden scale
#reverse code
dat$distant <- 8-dat$distant
dat$interact_diff <- 8-dat$interact_diff
dat$authen <- 8-dat$authen
dat$life_bw <- 8-dat$life_bw
dat$consq <- 8-dat$consq

#overall
dat$burden_tot <- dat %>% select(rum:consq) %>% rowMeans(na.rm=T)
describe(dat$burden_tot)
burden_tot <- dat %>% select(rum:consq)
alpha(burden_tot)

#subscales
dat$daily <- dat %>% select(rum:avoid_soc) %>% rowMeans(na.rm=T)
describe(dat$daily)
dailyburd <- dat %>% select(rum:avoid_soc)
alpha(dailyburd)

dat$extpull <- dat %>% select(oblig:guilt) %>% rowMeans(na.rm=T)
describe(dat$extpull)
extpull <- dat %>% select(oblig:guilt)
alpha(extpull)

dat$harmrel <- dat %>% select(distant:authen) %>% rowMeans(na.rm=T)
describe(dat$harmrel)
harmrel <- dat %>% select(distant:authen)
alpha(harmrel)

dat$antcnsq <- dat %>% select(uncomf_convo:consq) %>% rowMeans(na.rm=T)
describe(dat$antcnsq)
antcnsq <- dat %>% select(uncomf_convo:consq)
alpha(antcnsq)
```

###T1 Correlations
```{r}
cor.test(dat$daily, dat$authenscale)
cor.test(dat$extpull, dat$authenscale)
cor.test(dat$harmrel, dat$authenscale)
cor.test(dat$antcnsq, dat$authenscale)

cor.test(dat$daily, dat$flourish)
cor.test(dat$extpull, dat$flourish)
cor.test(dat$harmrel, dat$flourish)
cor.test(dat$antcnsq, dat$flourish)

cor.test(dat$daily, dat$anxious)
cor.test(dat$extpull, dat$anxious)
cor.test(dat$harmrel, dat$anxious)
cor.test(dat$antcnsq, dat$anxious)

cor.test(dat$daily, dat$depress)
cor.test(dat$extpull, dat$depress)
cor.test(dat$harmrel, dat$depress)
cor.test(dat$antcnsq, dat$depress)

cor.test(dat$daily, dat$relsatis)
cor.test(dat$extpull, dat$relsatis)
cor.test(dat$harmrel, dat$relsatis)
cor.test(dat$antcnsq, dat$relsatis)

cor.test(dat$harmrel, dat$daily)
cor.test(dat$antcnsq, dat$daily)

cor.test(dat$extpull, dat$intimacy_1)
cor.test(dat$daily, dat$intimacy_1)
cor.test(dat$harmrel, dat$intimacy_1)
cor.test(dat$antcnsq, dat$intimacy_1)

```



